<?php

namespace App\Models;

use App\Http\Controllers\Admin\Category\FeedbackCategoryController;
use App\Models\Category\Category;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Jedrzej\Pimpable\PimpableTrait;

class StoreServiceSpeechcraft extends Model
{
    use HasFactory;
    use PimpableTrait;
    use SoftDeletes;

    /**
     * 可搜索字段
     */
    public $searchable = [
        'service_id',
        'mer_id',
        'sort',
        'title',
        'content',
        'category_id',
    ];

    /**
     * 可批量赋值字段
     */
    public $fillable = [
        'service_id',
        'mer_id',
        'sort',
        'title',
        'content',
        'category_id',
    ];
    /**
     * 默认排序字段
     */
    protected $defaultSortCriteria = ['id,desc'];


    /**
     * 关联客服模型
     */
    public function storeservice(){
        return $this->belongsTo(StoreService::class,'service_id','id');
    }

    /**
     *关联商户模型
     */
    public function mer(){
        return $this->belongsTo(MerchantRegister::class,'mer_id','id');
    }

    /**
     * 关联分类的id
     */
    public function categories(){
        return $this->belongsTo(Category::class,'category_id','id');
    }
}
